package com.ecr.hub.database.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import com.ecr.hub.model.HubInputData;
import com.ecr.hub.model.enumeration.HubDataInputStatus;

public class MapperInputData {

	public static final String TABLE_INPUT_DATA = "hub_input_data";

	protected static ParameterizedRowMapper<HubInputData> mapperDataInput = new ParameterizedRowMapper<HubInputData>() {
		public HubInputData mapRow(ResultSet rs, int rowNum)
				throws SQLException {

			HubInputData inputData = new HubInputData();

			inputData.setId(rs.getInt("id"));
			inputData.setStatus(HubDataInputStatus.valueOf(rs
					.getString("status")));
			inputData.setDateProcessing(rs.getTimestamp("date_processing"));
			inputData.setFileAttachedName(rs.getString("file_name_attached"));
			inputData.setFileStoreName(rs.getString("file_name_store"));
			inputData.setErrorMessage(rs.getString("error_msg"));

			return inputData;
		}
	};

}
